package com.songlanyun.modules.information.model.dto;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.songlanyun.common.drive.ValueObject;
import com.songlanyun.common.validator.group.AddGroup;
import com.songlanyun.common.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 资讯
 *
 * @author WuChao
 * @email songlanyun@gmail.com
 * @date 2022-11-18 09:52:58
 */
@Data
public class InformationDto implements ValueObject {

    /**
     *
     */
    @NotNull(message = "ID不能为空", groups = UpdateGroup.class)
    private Long id;
    /**
     * 标题
     */
    @NotBlank(message = "标题不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Length(max = 100, message = "标题的长度不能超过100个字", groups = {AddGroup.class, UpdateGroup.class})
    private String title;
    /**
     * 分类ID
     */
    @NotNull(message = "分类ID不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Long classifyId;
    /**
     * 缩略图
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    @Size(max = 3, message = "缩略图最多可以上传3张", groups = {AddGroup.class, UpdateGroup.class})
    private JSONArray thumbnail;
    /**
     * 内容
     */
    private String content;
    /**
     * 序号
     */
    private Integer sort;
    /**
     * 发布者
     */
    @Length(max = 100, message = "发布者的长度不能超过100个字", groups = {AddGroup.class, UpdateGroup.class})
    private String publisher;
    /**
     * 推荐商品
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
//    @Size(max = 6, message = "推荐商品最多添加6个", groups = {AddGroup.class, UpdateGroup.class})
    private JSONArray recommendGoods;
    /**
     * 推荐门店
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
//    @Size(max = 6, message = "推荐门店最多添加6个", groups = {AddGroup.class, UpdateGroup.class})
    private JSONArray recommendShops;
    /**
     * 置顶
     */
    private Boolean top;
    /**
     * 置顶结束时间
     */
    private Date topEndTime;

}
